﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

public partial class loginControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    //protected void ok_Click(object sender, EventArgs e)
    //{
    //    string strConn = ConfigurationManager.ConnectionStrings["storeConnectionString"].ConnectionString;
    //    using(SqlConnection conn=new SqlConnection(strConn))
    //    {
    //        string strCmd = "select count(*) from 註冊表 where MemberName=@MemberName and Password=@Password";
    //        using(SqlCommand cmd=new SqlCommand(strCmd,conn))
    //        {
    //            cmd.Parameters.AddWithValue("@MemberName", TextAccount.Text);
    //            cmd.Parameters.AddWithValue("@Password",TextPwd.Text);
    //            conn.Open();
    //            if (Convert.ToInt32(cmd.ExecuteScalar()) > 0)
    //            {
    //                //登入成功

    //                Response.Cookies["login"].Value = TextAccount.Text;
    //                if (CheckBoxAutoLogin.Checked)
    //                {
    //                    Response.Cookies["login"].Expires = DateTime.Now.AddSeconds(20);

    //                }
    //                //轉跳頁
    //                if (Request.QueryString["returnUrl"] != null)
    //                {
    //                    //Server.Transfer(Request.QueryString["returnUrl"]);
    //                    Response.Redirect(Request.QueryString["returnUrl"]);

    //                }
    //                else
    //                {
    //                    Response.Redirect("~/index.aspx");
    //                }
    //            }
    //            else
    //            { 
    //                string strJSwrongpwd="alert('密碼錯誤!')";
    //                Page.ClientScript.RegisterStartupScript(this.GetType(),"",strJSwrongpwd,true);                
    //            }
    //        }
    //    }
    //}

    //protected void RegisterLink_Click(object sender, EventArgs e)
    //{
    //    //Request.Cookies["returnUrl"] 判斷 轉跳的來源頁
    //    Response.Redirect("~/regs.aspx");
    //}
    //protected void ForgetPwdLink_Click(object sender, EventArgs e)
    //{
    //    Response.Redirect("~/sendEmail.aspx");
    //}
}